<template>
	<view class="finish_pay_container">
		<view class="header_pay">
			<view class="order_num">
				<text>订单号：&nbsp;</text>
				<text>{{orderId}}</text>
			</view>
			<view class="pay_money">
				<text>支付金额：&nbsp;</text>
				<text class="money">￥{{price}}</text>
			</view>
		</view>
		<view class="pay_ways">
			<view class="quickPay">快捷支付</view>
			<u-divider half-width="100%"></u-divider>
			<view class="radio_group">
				<u-radio-group v-model="payWays" size="40" wrap active-color="#59d58b" @change="paySel">
					<u-radio name="wallet" class="radio">
						<text class="radioText">钱包(余额：15007元)</text>
					</u-radio>
					<u-divider half-width="100%"></u-divider>
					<u-radio name="alipay" class="radio">
						<text class="radioText">支付宝支付</text>
					</u-radio>
					<u-divider half-width="100%"></u-divider>
					<u-radio name="wechat" class="radio">
						<text class="radioText">微信支付</text>
					</u-radio>
					<u-divider half-width="100%"></u-divider>
					<u-radio name="online" class="radio">
						<text class="radioText">网银支付</text>
					</u-radio>
					<u-divider half-width="100%"></u-divider>
				</u-radio-group>
			</view>
		</view>
		<!-- 按钮 -->
		<view class="sure_btn" @click="sure">
			<view><text>保存</text></view>
		</view>
	</view>
</template>

<script>
	export default {
		onLoad(option) {
			console.log(option)
			this.price = option.price;
			this.optionSel = option.optionSel;
			this.orgSel = option.orgSel;
			this.userId = 300;
			this.productId = option.productId;
			this.addPrice = option.addPrice;
			this.order_date = option.date;
			console.log(option.optionSel) 
		},
		data() {
			return {
				//支付方式
				payWays: 'wallet',
				//订单号
				orderId: parseInt(Math.random() * 100000 + 999999),
				//总价格
				price: '',
				//选中的加项id
				optionSel: '',
				//体检机构的id
				orgSel: '',
				//用户id
				userId: 300,
				//支付方式
				payway: '',
				//套餐id
				productId: '',
				//体检日期
				order_date: '',
				//加项价格
				addPrice:0,
			}
		},
		methods: {
			//点击确定
			sure() {
				//添加到数据库
				console.log(this.optionSel)
				this.$http({
					url: '/addReserveOrder',
					data: {
						//订单号
						order_orderId: this.orderId,
						//用户id
						user_id: this.userId,
						//套餐id
						productId: this.productId,
						//加项id
						phy_id: this.optionSel,
						//订单状态
						order_status: "0",
						//订单价钱
						order_mongy: this.price,
						//支付方式
						order_payWays: this.payWays,
						//加项money
						addPrice:this.addPrice,
						//体检日期
						order_date:this.order_date,
					}
				})

				// uni.navigateTo({
				// 	url: '/pages/HXM/MineBooked/MineBooked',
				// })
			},
			//勾选支付方式
			paySel(value) {
				if(value==="wallet"){
					this.payway = '钱包';
				}else if(value==="alipay"){
					this.payway = '支付宝';
				}else if(value==="wechat"){
					this.payway = '微信';
				}else if(value==="online"){
					this.payway = '网银';
				}
			}
		}
	}
</script>

<style lang="scss">
	.finish_pay_container {
		.header_pay {
			font-size: 32rpx;
			margin: 30rpx 20rpx;
			background-color: rgba(221, 221, 221, 0.2);
			padding: 30rpx 0;

			.order_num {
				height: 80rpx;
				border-bottom: 1px solid #ccc;
				padding-bottom: 30rpx;
			}

			.pay_money {
				margin-top: 30rpx;

				.money {
					font-weight: 700;
					font-style: normal;
					font-size: 20px;
					color: #FF6600;
				}
			}
		}

		// 支付方式
		.pay_ways {
			padding: 20rpx;
			background-color: rgba(221, 221, 221, 0.1);

			.quickPay {
				font-size: 34rpx;
				color: #455154;
				margin-bottom: 10rpx;
			}

			.radio {
				padding: 30rpx;

				.radioText {
					margin-left: 30rpx;
					font-size: 35rpx;

				}
			}
		}

		// 底部按钮
		.sure_btn {
			width: 750rpx;
			height: 96rpx;
			background-color: #59b58d;
			color: white;
			font-size: 18px;
			text-align: center;
			position: fixed;
			bottom: 0;
			line-height: 96rpx;
		}
	}
</style>
